<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="/jsp/jstl/core"%>
<%@ taglib prefix="sp" uri="http://www.springframework.org/tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>My JSP 'add.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="This is my page" />
<link rel="stylesheet" type="text/css" href="/css/reset.css" />
<link rel="stylesheet" type="text/css" href="/css/common.css" />
<script type="text/javascript" src="/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/js/formcheck/formcheck-0.0.1.js"></script>
</head>

<body class="mainframe">
  <form id="memberForm" action="/member/register.dhtml" method="post">
    <table class="form01">
      <caption>添加用户</caption>
      <c:choose>
        <c:when test="${message.info != null }">
          <tr>
            <td colspan="2"><sp:message code="${message.info}" text="" /></td>
          </tr>
        </c:when>
        <c:otherwise>
          <tr>
            <td>用户名</td>
            <td><input type="text" id="loginName" name="member.loginname" /><span id="loginNameTip"></span></td>
          </tr>
          <tr>
            <td>密码</td>
            <td><input type="password" id="memberPwd" name="member.pwd" /><span id="memberPwdTip"></span></td>
          </tr>
          <tr>
            <td>重复密码</td>
            <td><input type="password" id="memberRepwd" name="member.repwd" /><span id="memberRepwdTip"></span></td>
          </tr>
          <tr>
            <td>邮箱</td>
            <td><input type="text" id="memberEmail" name="member.email" /><span id="memberEmailTip"></span></td>
          </tr>
          <tr>
            <td></td>
            <td><input type="submit" id="submit_member" class="button01" value="添加" /></td>
          </tr>
        </c:otherwise>
      </c:choose>
    </table>
  </form>
  <script type="text/javascript">
			$(document).ready(function() {
				// 表单验证
				// 表单验证
				var formCheck = $.formCheck();
				formCheck.regLoginNameLimit("loginName", {
					onShow : "输入用户名",
					onFocus : "用户名由5-20个字母、数字、下划线组成且必须以字母开头",
					onError : "用户名由5-20个字母、数字、下划线组成且必须以字母开头",
					onCorrect : "用户名输入正确"
				}, 5, 20, true);
				formCheck.regPasswordLimit("memberPwd", {
					onShow : "输入密码",
					onFocus : "密码由5-20个字母、数字、下划线组成",
					onError : "密码由5-20个字母、数字、下划线组成",
					onCorrect : "密码输入正确"
				}, 5, 20, true);
				formCheck.regPasswordLimit("memberRepwd", {
					onShow : "再次输入密码",
					onFocus : "密码由5-20个字母、数字、下划线组成",
					onError : "密码由5-20个字母、数字、下划线组成",
					onCorrect : "再次密码输入正确"
				}, 5, 20, true);
				
				formCheck.regEmail("memberEmail", {
					onShow : "输入邮箱",
					onFocus : "输入邮箱",
					onError : "邮箱格式错误",
					onCorrect : "邮箱输入正确"
				}, true);
				
				formCheck.formCheck("memberForm");
			});
		</script>
</body>
</html>